
package jfireeagle.examples.swing;

import javax.swing.JTextField;
import java.util.*;
import jfireeagle.*;

public class WithinForm extends AbstractForm
{
	private JTextField lat = new JTextField(15);
	private JTextField lon = new JTextField(15);
	
	public WithinForm(FireEagleClient c)
	{
		super(c, 2);
		
		this.addField("Latitude", lat);
		this.addField("Longitude", lon);
	}

	@Override
	protected Object onSubmit()
	{
		
		GpsCoordinate coordinate = new GpsCoordinate(lat.getText(), lon.getText());
		
		LocationParameters loc = new LocationParameters();
		loc.setGpsCoordinate(coordinate);
		
		List<User> users = this.getClient().within(loc);
		
		return users;
	}
}
